package fr.bda.cloud.storage;

import java.util.List;

import fr.bda.cloud.data.DataDescriptor;

/**
 * This class represent a storage unit available in the cloud
 * 
 * @author BARET
 * @since 21/10/2012
 */
public abstract class StorageUnit {

	/** Separator use for connection id parsing */
	public static final String SEP_KEY = "~";

	public static final String EXT_DATA = ".data";
	public static final String EXT_DESC = ".desc";
	/**
	 * 
	 * @return The list of data available on the storage unit
	 */
	public abstract List<DataDescriptor> listData();

	/**
	 * Get the bytes of the storage unit
	 * 
	 * @param dataDescriptor
	 *            The data descriptor
	 * @return The bytes targeted by the data descriptor
	 */
	public abstract byte[] readData(DataDescriptor dataDescriptor);

	/**
	 * To set a data on the storage unit
	 * 
	 * @param dataDescriptor
	 *            The data descriptor
	 * @param data
	 *            The data to save
	 */
	public abstract void saveData(DataDescriptor dataDescriptor, byte[] data);

	
	public abstract void clearData(DataDescriptor dataDescriptor);
	
	
}
